<template>
  <div>
    <el-card style="margin:10px;min-height:400px">
      <el-button
        type="primary"
        size="mini"
        icon="el-icon-arrow-left"
        @click="returnTestList"
      >返回</el-button>
      <el-table :data="list"  stripe @row-click="enterCheckTest">
        <el-table-column type="index" width="100px" align="center" label="序号">
        </el-table-column>
        <el-table-column  prop="realName" label="姓名">
        </el-table-column>
        <el-table-column   prop="username" label="账号">
        </el-table-column>
        <el-table-column   prop="submitTImes" label="剩下提交次数">
        </el-table-column>
        <el-table-column   prop="updateTime" label="最后一次提交时间">
        </el-table-column>
        <el-table-column label="提交">
            <template>
                <span>已提交</span>
            </template>
        </el-table-column>
        <el-table-column label="总分">
            <template slot-scope="{row,$index}">
                <span v-if="row.isChecked">{{row.score}}分</span>
                <span style="color:#F56C6C" v-else>未批改</span>
            </template>
        </el-table-column>
      </el-table>

    </el-card>
  </div>
</template>

<script>
import dayjs from 'dayjs'
export default {
    props:['id'],
    data(){
        return {
            list:[]
        }
    },
    methods:{
        async getCheckList(){
            console.log(this.id);
            const res = await this.$API.test.getCheckList(this.id)
            if(res.code == 200){
                res.data.forEach(item=>{
                    item.updateTime = dayjs(item.updateTime).format('MM-DD hh:mm:ss')
                })
                this.list = res.data
                console.log(this.list);
            }
        },
        returnTestList(){
            this.$router.back(1)
        },
        enterCheckTest(row){
            this.$router.push({
                name: "CheckTestDetail",
                params:{
                    testId: row.testId,
                    userId: row.id
                }
            })
        }
    },
    mounted(){
        this.getCheckList()
    }
};
</script>

<style>
</style>